

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include "gui_datatypes.h"
#include "gui_basedata.h"
#include "gui_drawbase.h"
#include "gui_data.h"
#include "gui_osd.h"
#include "gui_language.h"
#include "hi_type.h"
#include "hi_go_comm.h"
#include "hi_go_text.h"
//////////////////////////////////////////////////////////////////////

//extern ULONG FHK24_ImageData[];
/////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////



//////////////////////////////////


HI_HANDLE g_ahFont[UI_E_FONT_SIZE_BUTT];// = {hFont16, hFont20, hFont24, hFont28, hFont32, hFont36, hFont40};
HI_HANDLE g_DsFont;// = {hFont16, hFont20, hFont24, hFont28, hFont32, hFont36, hFont40};
    
HI_HANDLE getFontHandle(UI_E_FONT_SIZE enFontSize)
{
    /** check param */
    if (UI_E_FONT_SIZE_BUTT <= enFontSize)
    {
        LOGE("getFontHandle param error!\n");
        return g_ahFont[UI_E_FONT_SIZE_28];
    }
	//LOGD("hFont = 0x%x\n",hFont);
    return g_ahFont[enFontSize];
}
    
HI_HANDLE getDsFontHandle()
{
    return g_DsFont;
}

int createFont(const HI_CHAR *pMbFontFile,const HI_CHAR *pSbFontFile,const HI_U32 size)
{
    int i = 0;
    int ret = 0;
    HIGO_TEXT_INFO_S stTextInfo;
    if( (pMbFontFile==NULL) && (pSbFontFile==NULL) )
    {
            LOGE("failed to find font file!!!\n");
    }
    stTextInfo.pSbcFontFile = pSbFontFile;
    stTextInfo.pMbcFontFile = pMbFontFile;
    stTextInfo.u32Size = size;    

    for (i = 0; i < (sizeof(g_ahFont) / sizeof(HI_HANDLE)); i++)
    {
        stTextInfo.u32Size = 16 + i;
        /** create the object of text display */    
        ret = HI_GO_CreateTextEx(&stTextInfo, &g_ahFont[i]);
        if (HI_SUCCESS != ret) 
        {
              LOGE("failed to create the font!ret = 0x%x\n",ret);
              return ret;
        }
        //LOGD("Font Handle%d:0x%x\n",i,g_ahFont[i]);
    }
    stTextInfo.pSbcFontFile = pSbFontFile;
    stTextInfo.pMbcFontFile = "/app/DS-DIGIB.TTF";
    stTextInfo.u32Size = 48;    
    ret = HI_GO_CreateTextEx(&stTextInfo, &g_DsFont);
    if (HI_SUCCESS != ret) 
    {
          LOGE("failed to create g_DsFont font!ret = 0x%x\n",ret);
          return ret;
    }
    return OK;
}

